<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>银行卡管理</title>
    <link href="css/mui.css" rel="stylesheet"/>
    <link href="css/user.css" rel="stylesheet"/>
</head>
<body>
<div id="app" v-cloak>
    <header class="mui-bar mui-bar-nav header">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
        <a class="mui-icon mui-pull-right" :href="'user_bank_add.html?id='+ memberId">
            <img src="images/addImg.png">
        </a>
        <h2 class="mui-title">银行卡管理</h2>
    </header>

    <div id="pullrefresh" class="mui-content" style="background: #f2f2f2;">
        <div class="userWithdrawal">
            <div class="userWithdrawalSec">
                <div class="userIndexList">
                    <ul class="mui-table-view">
                        <li class="mui-table-view-cell" v-for='item in card'>
                            <div class="bankList">
                                <div class="bankList_l">
                                    <!-- <img src="images/bank1.png"> -->
                                    <div class="bankList_lTxt">
                                        <h5 :data-cid="item.id">{{item.bankName}}</h5>
                                        <p>**** **** **** {{item.cardNo.substr(item.cardNo.length-4)}}</p>
                                    </div>
                                </div>
                                <!-- <div class="bankList_r">
                                    <span v-if='item.defaultflag === "DEFAULTACCOUNT"'>默认</span>
                                </div> -->
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/mui.min.js"></script>
<script type="text/javascript" src="js/vue.js"></script>
<script type="text/javascript" src="js/rem.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script type="text/javascript">
    'use strict'

    $(document).ready(function () {
		if(!sessionStorage.getItem("Authorization")){
			mui.alert('', '请先登录', function () {
				window.location.href = 'login.html'
			})
		}
        new Vue({
            el: '#app',
            data: {
                card: [],
                memberId: ''
            },
            mounted: function () {
                this.getBankCard()
                sessionStorage.removeItem('bkname')
                sessionStorage.removeItem('bkid')
                $('body').on('click','.userIndexList li',function(){
                    sessionStorage.setItem('bkname',$(this).find('.bankList_lTxt h5').text())
                    sessionStorage.setItem('bkid',$(this).find('.bankList_lTxt h5').attr('data-cid'))
                    window.location='user_withdrawal.html'
                })
            },
            methods: {
                /**
                 *  获取银行卡列表
                 */
                getBankCard: function () {
                    let url = 'biz/api/getInquiryBankCard',
                        that = this

                    let getBankCardSuc = (data) => {
                        // console.log(data)

                        that.card = data.data

                        if (data.data.length > 0) {
                            that.memberId = data.data[0].memberId
                        }
                    }

                    let getBankCardErr = (err) => {
                        console.log(err)
                    }

                    common.ajax(url, {}, getBankCardSuc, getBankCardErr)
                }
            }
        })
    })
</script>
</html>
